<template>
	<view>
		<view class="mt-5" v-if="u_loadmore">
			<u-loadmore status="loading" icon-type="circle" />
		</view>
		<view v-else>
			<jinEdit :goods_id="goods_id" v-if="desc_detail" :name="tempimage" :html="desc_detail" placeholder="请输入内容" @editOk="editOk" :uploadFileUrl="url">{{desc_detail}}</jinEdit>
			<jinEdit :goods_id="goods_id" v-else :html="desc_detail" :name="tempimage" placeholder="请输入内容" @editOk="editOk" :uploadFileUrl="url">{{desc_detail}}</jinEdit> 
		</view>
	</view>
</template>

<script>
	import jinEdit from '@/components/jin-edit/jin-edit.vue';
	export default {
		components: {
			jinEdit
		},
		props:["res_html"],
		data() {
			return {
				url:`${this.localConfig.web_Url}v2/store/medialibrary/image/temp/upload`,
				desc_detail:"", // 描述详情
				goods_id:'', // 商品ID
				u_loadmore:true, // 加载中
			}
		},
		methods: {
			// 点击发布
			editOk(res) {
				this.$H.post("admin/goods/update/desc",{
					goods_id:this.goods_id,
					goods_desc:res.html
				}).then(reslove=>{
					uni.navigateBack({
						delta:1
					})
				})
			},
		},
		onLoad(e) {
			this.goods_id=e.goods_id
			console.log(e)
			this.$H.post("admin/goods/desc",{
				goods_id:this.goods_id
			}).then(res=>{
				console.log(res.data)
				this.desc_detail=res.data
				this.u_loadmore=false 
			})
		}
	}
</script>

<style>
	page{
		background-color: #FFFFFF;
	}
	.edit{
		background-color: #fafbfd;
		border: 1px solid #8fa78b;
	}
</style>
